package com.foreknow.demo4;

import java.util.Scanner;

public class LianXi1 {
    //注册
    //insert into user(username，password) values('?','?')
    public static boolean zhuce(String username,String password) {
        System.out.println("注册");
        boolean Zhuce = false;
        return Zhuce;
    }

    //登录方法
    //select * from user where  username =(?) and password =(?)
    public static boolean Login(String name,String password) {
        boolean isLogin = false;
        System.out.println("登录");
        return isLogin;
    }

    //根据id查询某个用户的信息
    //select * rom user where id =(?)
    public static String[] select(int id){
        String[] message = new String[10];
        message[0] = "xiaowang";
        System.out.println("查询成功！");
        System.out.println(message);
        return message;
    }

    //查询所有用户的信息
    //select * from user
    public static String[] allSelect() {
        String[] allMessage = new String[10];
        allMessage[0] = "tom";
        allMessage[1] = "lily";
        System.out.println("查询成功！");
        System.out.println(allMessage);
        return allMessage;
    }

    //根据id删除某个用户的信息
    //delete from user where id = (?)
    public static int delete(int id) {
        return 1;
    }



    public static void main(String[] args) {
//        Scanner input = new Scanner(System.in);
//        System.out.println("请输入用户名：");
//        String username = input.next();
//        System.out.println("请输入密码");
//        String password = input.next();

        int a = delete(1001);
        if (a == 1) {
            System.out.println("删除成功！");
        } else {
            System.out.println("删除失败！");
        }

        String[] all = allSelect();
        for (int i = 0;i<all.length;i++) {
            System.out.println(all[i]);
        }

        String[] partall = select(1234);
        for (int i = 0;i<all.length;i++) {
            System.out.println(partall[i]);
        }

        boolean Zhuce = zhuce("tom","123456");
        if (Zhuce) {
            System.out.println("注册成功！");
        } else {
            System.out.println("注册失败！");
        }
    }

}









